//
//  ImageViewController.m
//  LOU
//
//  Created by apple on 15/11/17.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "ImageViewController.h"
#import "Size.h"
#import "UIImageView+Tranform3D.h"
#import "LSBGetDegress.h"
@interface ImageViewController ()

@end

@implementation ImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, WindowWidth, WindowHeight - 113)];
    imageV.image = [UIImage imageNamed:@"2.jpg"];
    [self.view addSubview:imageV];
    
    [LSBGetDegress getDegressWithBlock:^(CMAccelerometerData *latestAcc, NSError *error) {
        if (latestAcc.acceleration.y < 0.0&&latestAcc.acceleration.y >= -1.0) {
            [imageV setRotation:80*latestAcc.acceleration.y];
        }
        else if (latestAcc.acceleration.z*-1 >0.0 && latestAcc.acceleration.z*-1 <= 1.0)
        {
            [imageV setRotation:80 - ( 80*latestAcc.acceleration.z*-1)];
            NSLog(@"------------%f",80*latestAcc.acceleration.z*-1);
        }
        
    }];
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
